package com.ocom.common.entity.card;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.ocom.common.entity.base.EntityCardBase;
import com.ocom.common.utils.CommonUtil;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName(value = "xf_merchant_info")
public class EntityXfMerchantInfo extends EntityCardBase implements Serializable {

    private static final long serialVersionUID = 6547350821202689494L;
    @TableId(value = "merch_id", type = IdType.AUTO)
    private Integer merchId;
    @TableField(exist = false)
    @JsonProperty("feeAccountId")
    private Integer feeAccountId;
    @JsonProperty(value = "comId")
    private Long comId;
    @JsonProperty(value = "merchName")
    private String merchName;
    @TableField(value = "parent_merch_id")
    @JsonProperty(value = "parentMerchId")
    private Integer parentMerchId;
    private String merchOrgin;
    private String remark;
    //商户号(收款)
    @JsonProperty(value = "merch_no")
    private String merchNo;
    @TableField(exist = false)
    private List<String> merchIds=new ArrayList<>();
    @TableField(exist = false)
    private String payDate;
    @JsonProperty(value = "manage_rate")
    private BigDecimal manageRate;
    @JsonProperty(value = "merch_no_out")
    private String merchNoOut;

    private String merchantUsername;
    private String merchantPhone;
    private String merchFullName;
    private String merchLicense;
    private String licensePhoto;
    private String merchPermit;
    private String permitPhoto;


    private Boolean withholdSubmerch;
    private Integer feeFlag;

    //统一支付的企业Id
    @TableField(exist = false)
    private String companyId = "";
    @TableField(exist = false)
    private String userName = "";
    @TableField(exist = false)
    private String password = "";

    @TableField(exist = false)
    private String strParentMerchs;

    private Long merchType;

    @TableField(exist = false)
    @JsonProperty(value = "feeAccountName")
    private String feeAccountName;

    public String getFeeAccountName() {
        if (!CommonUtil.isNull(merchName)) {
            return merchName;
        } else{
            return feeAccountName;
        }
    }
    
}
